package com.itheima;

import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;

public class Test06 {
    public static void main(String[] args) {
        String s1="2001年04月11日";
        String s2="2021年04月11日";
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        LocalDate ld1=LocalDate.parse(s1,formatter);
        System.out.println(ld1);
        LocalDate ld2=LocalDate.parse(s2,formatter);
        Period b= Period.between(ld1, ld2);
        System.out.println(b);
        long l = b.toTotalMonths();
        System.out.println("l = " + l);
        
    }
}
